<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta charset="UTF-8">
	<title></title>
	<link type="text/css" rel="stylesheet" href="http://127.0.0.1/c45_classCode/Static/hdjs/hdjs.css"/>
	<script type="text/javascript" src="http://127.0.0.1/c45_classCode/Static/hdjs/hdjs.min.js"></script>
</head>
<body>
	
	<div class="hd-menu-list">
	    <ul>
	        <li class="active"><a href="<?php echo U('Article/index');?>">文章列表</a></li>
	        <li><a href="<?php echo U('Article/add');?>">添加文章</a></li>

	    </ul>
	</div>
	
	<table class="hd-table hd-table-list">
	    <thead>
	    <tr>
	        <td>AID</td>
	        <td>缩略图</td>
	        <td>文章标题</td>
	        <td>所属栏目</td>
	        <td>已选标签</td>
	        <td>操作</td>
	    </tr>
	    </thead>
	    <tbody>
	    
	    <?php foreach ($data as $k=>$d){?>
		    <tr>
		    	<td><?php echo $d['aid'];?></td>
		    	<td><img class="hd-w50 hd-h50" src="http://127.0.0.1/c45_classCode/<?php echo $d['thumb'];?>" alt=""></td>
		        <td><?php echo $d['title'];?></td>
		        <td><?php echo $d['cname'];?></td>
		        <td>
		        	        <?php
        //初始化
        $hd['list']['t'] = array(
            'first' => false,
            'last'  => false,
            'total' => 0,
            'index' => 0
        );
        if (empty($d['tags'])) {
            echo '';
        } else {
            $listId = 0;
            $listShowNum=0;
            $listNextId=0;
            foreach ($d['tags'] as $t) {
                //开始值
                if ($listId<0) {
                    $listId++;
                    continue;
                }
                //步长
                if($listId!=$listNextId){$listId++;continue;}
                //显示条数
                if($listShowNum>=100)break;
                //第几个值
                $hd['list'][t]['index']++;
                //第1个值
                $hd['list'][t]['first']=($listId == 0);
                //最后一个值
                $hd['list'][t]['last']= (count($d['tags'])-1 <= $listId);
                //总数
                $hd['list'][t]['total']++;
                //增加数
                $listId++;
                $listShowNum++;
                $listNextId+=1
                ?>
		        		<?php echo $t['tname'];?>&emsp;
		        	<?php }}?>
		        </td>
		        <td class="hd-w100">
		            <a href="<?php echo U('Article/edit',array('aid'=>$d['aid']));?>">修改</a> |
		           
		        </td>
		    </tr>
		<?php }?>

	    </tbody>
	</table>
	
</body>
</html>